import ajax from '@/api/apiConfig.js'
import store from '@/store/store'

// 获取七牛token
export const qnToken = data => {
  if (uploadOnNginx) {
    return new Promise(function (resolve) {
      resolve({
        data: 'xvVJEmr_GEDWJqyXicuk5gJlF8mHq5EZsA75Dl-e:JncCcjDFdbGWhVRKg4qqSEiJnBs=:eyJzY29wZSI6ImlsaW5rbmgiLCJkZWFkbGluZSI6MTY1NzA4MDY4Nn0='
      })
    })
  }
  return ajax.get('common/getQnToken', {
    userName: store.state.userInfo.accountName,
    deviceId: store.state.appKeyObj.deviceId,
  })
}

// 获取标签列表
export const getLableList = data => {
  return ajax.get('common/getLableList', data)
}

// 获取多个单位的建筑物树
export const getOrgFbsTree = data => {
  return ajax.get('buildingStructure/getOrgFbsTree', data)
}

// 获取用户订阅的建筑物树
export const getUserRelateFbsTree = data => {
  return ajax.get('buildingStructure/getUserRelateFbsTree', data)
}

// 获取用户订阅的建筑物id集合
export const getUserBuildByAccount = data => {
  return ajax.get('user/getUserBuildByAccount', data)
}

// 保存用户订阅的建筑物
export const saveSubscribe = data => {
  return ajax.post('user/saveUserBuild', data)
}

export const getDict = data => {
  return ajax.get('common/getDict', data)
}

export const addUserConcem = data => {
  return ajax.post('user/addUserConcem', data)
}
